<form action="{:url()}" method="post" class="form_single">
    <div class="box">
        <div class="box-body">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品分类</label>
                        <span class="">（商品分类）</span>
                        <select name="catid" class="form-control">
                            {volist name='cat_list' id='vo'}
                            <option value="{$vo['id']}" {notempty name="info['catid']"}{if condition="$info['catid'] eq $vo['id']"} selected="selected" {/if}{/notempty} >{$vo['title']}</option>
                            {volist name='vo.catlist' id='v'}
                            <option value="{$v['id']}" {notempty name="info['catid']"}{if condition="$info['catid'] eq $v['id']"} selected="selected" {/if}{/notempty} >&nbsp;&nbsp;--&nbsp;&nbsp;{$v['title']}</option>
                            {volist name='v.catlist' id='val'}
                            <option value="{$val['id']}" {notempty name="info['catid']"}{if condition="$info['catid'] eq $val['id']"} selected="selected" {/if}{/notempty} >&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;{$val['title']}</option>
                            {/volist}
                            {/volist}
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品类型</label>
                        <span class="">（线上线下）</span>
                        <select name="is_xx" class="form-control">
                            <option value="0" {notempty name="info['is_xx']"}{if condition="$info['is_xx'] eq 0"} selected="selected" {/if}{/notempty} >线上</option>
                            <option value="1" {notempty name="info['is_xx']"}{if condition="$info['is_xx'] eq 1"} selected="selected" {/if}{/notempty} >线下</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品名称</label>
                        <span class=""></span>
                        <input class="form-control" name="title" placeholder="请输入商品名称" value="{$info['title']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品副标题</label>
                        <span class=""></span>
                        <input class="form-control" name="ftitle" placeholder="请输入商品副标题" value="{$info['ftitle']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品零售价</label>
                        <span class=""></span>
                        <input class="form-control" name="money" placeholder="请输入商品单价" value="{$info['money']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品原价</label>
                        <span class=""></span>
                        <input class="form-control" name="max_money" placeholder="请输入商品原价" value="{$info['max_money']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品属性</label>
                        <span class="">（用‘/’隔开，如“红色/蓝色/白色”）</span>
                        <input class="form-control" name="goodstype" placeholder="请输入商品属性" value="{$info['goodstype']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>库存数量</label>
                        <span class=""></span>
                        <input class="form-control" name="num" placeholder="请输入招募数量" value="{$info['num']|default='0'}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>结算比例</label>
                        <span class=""></span>
                        <input class="form-control" name="bl" placeholder="请输入结算比例" value="{$info['bl']|default=''}" type="number">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>补贴比例</label>
                        <span class=""></span>
                        <input class="form-control" name="btbl" placeholder="请输入分润比例" value="{$info['btbl']|default=''}" type="number">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>利润比例</label>
                        <span class=""></span>
                        <input class="form-control" name="lrbl" placeholder="请输入利润比例" value="{$info['lrbl']|default=''}" type="number">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>抢购结束时间</label>
                        <span class=""></span>
                        <input class="form-control" autocomplete="off" name="end_time" id="end_time" placeholder="请输入抢购结束时间" value="{$info['end_time']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>有效期</label>
                        <span class=""></span><br/>
                        <input class="form-control" style="width:30%;display:inline" autocomplete="off" name="start_time" id="start_time" placeholder="开始时间" value="{$info['start_time']|default=''}" type="text"> -
                        <input class="form-control" style="width:30%;display:inline" autocomplete="off" name="invalid_time" id="invalid_time" placeholder="结束时间" value="{$info['invalid_time']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>直推收益</label>
                        <span class=""></span>
                        <input class="form-control" autocomplete="off" name="zt_money"  placeholder="请输入直推收益" value="{$info['zt_money']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>间推收益</label>
                        <span class=""></span>
                        <input class="form-control" autocomplete="off" name="jt_money"  placeholder="请输入间推收益" value="{$info['jt_money']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>省市区</label>
                        <span class=""></span><br/>
                        <select name="county" id="county" class="form-control" style="width:30%;float:right;">
                            <option value="">区县</option>
                            {notempty name="clist"}
                            {volist name='alist' id='vo'}
                            <option value="{$vo['name']}" {notempty name="info['county']"}{if condition="$info['county'] eq $vo['name']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                            {/volist}
                            {/notempty}
                        </select>
                        <select name="city" id="city" class="form-control" style="width:30%;float:right;">
                            <option value="">市区</option>
                            {notempty name="clist"}
                            {volist name='clist' id='vo'}
                            <option value="{$vo['name']}" {notempty name="info['city']"}{if condition="$info['city'] eq $vo['name']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                            {/volist}
                            {/notempty}
                        </select>
                        <select name="province" id="province" class="form-control" style="width:30%;float:right;">
                            <option value="">省份</option>
                            {volist name='plist' id='vo'}
                            <option value="{$vo['name']}" {notempty name="info['province']"}{if condition="$info['province'] eq $vo['name']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>详细地址</label>
                        <span class=""></span>
                        <input class="form-control" autocomplete="off" name="address"  placeholder="请输入详细地址" value="{$info['address']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>联系电话</label>
                        <span class=""></span>
                        <input class="form-control" autocomplete="off" name="phone"  placeholder="请输入联系电话" value="{$info['phone']|default=''}" type="text">
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品主图</label>
                        <span class="">（请上传单张正方形图片）</span>
                        <br/>
                        {assign name="img_id" value="$info.img_id|default='0'" /}
                        {:widget('admin/file/index', ['name' => 'img_id', 'value' => $img_id, 'type' => 'img'])}
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>分享背景图</label>
                        <span class=""></span>
                        <br/>
                        {assign name="share_id" value="$info.share_id|default='0'" /}
                        {:widget('file/index', ['name' => 'share_id', 'value' => $share_id, 'type' => 'img'])}
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品轮播图片</label>
                        <span class="">（请上传2·5张正方形图片）</span>
                        <br/>
                        {assign name="img_ids" value="$info.img_ids|default=''" /}
                        {:widget('admin/file/index', ['name' => 'img_ids', 'value' => $img_ids, 'type' => 'imgs'])}

                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>商品详情图片</label>
                        <span class="">（长方形、正方形均可）</span>
                        <br/>

                        {assign name="cont_ids" value="$info.cont_ids|default=''" /}
                        {:widget('admin/file/index', ['name' => 'cont_ids', 'value' => $cont_ids, 'type' => 'imgs'])}

                    </div>
                </div>

            </div>
            <div class="row">


                <div class="col-md-12">
                    <div class="form-group">
                        <label>商品内容</label>
                        <textarea class="form-control textarea_editor" name="content" placeholder="请输入文章内容">{$info['content']|default=''}</textarea>
                        {:widget('editor/index', array('name'=> 'content','value'=> ''))}
                    </div>
                </div>

            </div>
            <div class="box-footer">

                <input type="hidden" name="id" value="{$info['id']|default='0'}"/>

                {include file="layout/edit_btn_group"/}

            </div>
            <script>
                laydate.render({
                    elem: '#end_time'
                });
                laydate.render({
                    elem: '#invalid_time'
                });
                laydate.render({
                    elem: '#start_time'
                });
                $("input[name='username']").blur(function(){
                    $.post("{:url('checkUsername')}",{username:$(this).val()},function(data){
                        if(data.code == 0){
                            $("#dian").html(data.name);
                        }else{
                            layer.msg(data.msg);
                            $("input[name='username']").val('');
                        }
                    },'json')
                })
                $("#province").change(function(){
                    var id=$(this).val();
                    $.post("{:url('user_province')}",{id:id},function( data ){
                        if(data.code==0){
                            $("#city").html(data.html);
                        }else{
                            layer.msg(data.msg);
                        }
                    },'json');
                });
                $("#city").change(function(){
                    var id=$(this).val();
                    $.post("{:url('user_city')}",{id:id},function( data ){
                        if(data!=""){
                            $("#county").html(data);
                        }else{
                            alert("未知错误！");
                        }
                    });
                });
            </script>
        </div>
    </div>
</form>
